package ch.ethz.fcl;

import ch.ethz.fcl.draw.Bounds;
import ch.ethz.fcl.draw.Circle;
import ch.ethz.fcl.udp.UDPClient;
import ch.ethz.fcl.user.interaction.MultiTouchHandler;
import ch.ethz.fcl.R;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.Display;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.ImageView;

public class MetroBuzzAndroidActivity extends Activity {
	private final String TAG = "MetroBuzz";
	String ip;
	EditText ipinput;
	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);

		Display screen = getWindowManager().getDefaultDisplay();
		Bounds.setMaxX(screen.getWidth());
		Bounds.setMaxY(screen.getHeight());
		
		Circle circle = new Circle(this, 200, 200, 20);
		
		ImageView zurich = (ImageView) findViewById(R.id.zurichMap);
		zurich.setOnTouchListener(new MultiTouchHandler(circle));
		
		ipinput = (EditText)findViewById(R.id.ipaddress);
		
		Button enter = (Button)findViewById(R.id.enter);
		enter.setOnClickListener(new OnClickListener(){
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				ip = ipinput.getText().toString();
				UDPClient.ip = ip;
				Log.d(TAG, ip);
			}			
		});
		
		FrameLayout display = (FrameLayout) findViewById(R.id.display);
		display.addView(circle);
	}
}